/**
 * @file Sidebar configuration for documentation entries.
 *
 * @import { SidebarItemConfig } from "@docusaurus/plugin-content-docs/src/sidebars/types.js"
 */

import "./ensure-reference-sidebar.mjs";

// No file extensions for Docusaurus's automatic resolution.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - Allows for project-wide type checking when partially building docs.
import apiReference from "./reference/sidebar";

const DOCS_URL = process.env.DOCS_URL || "https://docs.goauthentik.io";

/**
 * @type {SidebarItemConfig}
 */
const sidebar = {
    reference: [
        {
            type: "link",
            label: "← Back to Developer Docs",
            href: new URL("/developer-docs", DOCS_URL).href,
            className: "navbar-sidebar__upwards",
        },
        {
            type: "doc",
            label: "API Overview",
            className: "api-overview",
            id: "index",
        },

        {
            type: "doc",
            label: "Authentication",
            id: "authentication",
        },

        {
            type: "doc",
            label: "Flow executor (backend)",
            id: "flow-executor",
        },

        {
            type: "category",
            label: "API Clients",
            collapsed: false,
            collapsible: false,
            link: {
                type: "doc",
                id: "clients",
            },
            items: [
                {
                    type: "autogenerated",
                    dirName: "clients",
                },
            ],
        },

        {
            type: "category",
            label: "API Reference",
            className: "api-reference",
            collapsed: false,
            collapsible: false,
            link: {
                type: "doc",
                id: apiReference[0].id,
            },

            items: apiReference.slice(1),
        },
    ],
};

export default sidebar;
